package com.eos.control.action.customer;

import com.eos.business.service.SysProductBusinessService;
import com.eos.common.tool.ConstantTool;
import com.eos.common.tool.ObjectUtils;
import com.eos.control.action.base.AbstractBaseAction;
import com.eos.orm.mybatis.model.SysColour;
import com.eos.orm.mybatis.model.SysUser;

public class DeleteColorAction extends AbstractBaseAction {
	private static final long serialVersionUID = -3500114860081831060L;
	private Integer colorId;

	public void setColorId(Integer colorId) {
		this.colorId = colorId;
	}

	@Override
	public String execute()  {
		try {
			if(null ==  colorId || colorId.intValue()==0){
				statusCode = "300";
				message = "参数错误,删除颜色信息失败!";
			}else{
				SysUser user = (SysUser) getSession().getAttribute("SysUser");
				SysColour color = new SysColour();
				color.setId(colorId);
				color.setDealFlag(ConstantTool.DEAL_FLAG_FAIL);
				color.setUpdateUserId(user.getId()+"");
				color.setModifyTime(ObjectUtils.formatDate(null, "yyyy-MM-dd HH:mm:ss"));
				SysProductBusinessService spbs = new SysProductBusinessService();
				String exeStatus = spbs.updateSysColorSelective(color);
				if("SUCCESS".equals(exeStatus)){
					statusCode = "200";
					message = "删除颜色信息成功!";
				}else{
					statusCode = "300";
					message = "系统繁忙, 删除颜色信息失败!";
				}
			}
		} catch (Exception e) {
			e.printStackTrace();
			statusCode = "300";
			message = "系统异常,删除颜色信息失败!";
		}
		return SUCCESS;
	}
}
